(() => {
    class Animal {
        constructor(name) {
            this.name = name;
        }
        sayHello() {
            console.log(`${this.name}sayHello`);
        }
    }
    class Dog extends Animal {
        constructor(name, age) {
            super(name); //必须先调用父类的构造函数
            age = this.age;
        }
        sayHello() {
            super.sayHello(); //super表示当前类的父类
        }
    }
    const dog = new Dog('旺财', 1);
    dog.sayHello();
})();
